<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button id="button" tag="popup">点击</button>
    <script src="./aop.js"></script>
    <script>
        let showPopup = function() {
            console.log('打开弹窗');
        }

        // 装饰器实现数据统计
        let log = function() {
            console.log('统计标签：' + this.getAttribute('tag'));
        }
        showPopup = showPopup.after(log);

        document.getElementById('button').onclick = showPopup;
    </script>
</body>
</html>